<template>
  <d-dialog class="leader-add-drawer" :header="headerText" v-model:visible="visible" :footer="null">
    <img :src="formData.qrCode" class="w-300px h-300px" />
  </d-dialog>
</template>

<script setup>
import { ref, computed } from 'vue'
import { get } from '@common'
const api = 'basic/guest'
const INIT_STATUS = {
  id: '',
  name: ''
}
const visible = ref(false)
const formData = ref({ ...INIT_STATUS })
const headerText = ref('二维码')

const show = async (info = {}) => {
  if (info?.id) {
    const res = await get(`${api}/${info.id}`)
    formData.value = res.data
  } else {
    formData.value = { ...INIT_STATUS }
  }
  visible.value = true
}

defineExpose({ show })
</script>
<style lang="less">
.leader-add-drawer {
  text-align: center;
}
</style>
